/*
-------------------------------------------------

	Render.h

	Dmitriy Kuzmenko (Dgut)

-------------------------------------------------
*/

#ifndef __AUTUMN_RENDER_H__
#define __AUTUMN_RENDER_H__

#include "Singleton.h"
#include "Font.h"
#include <map>
#include <string>

namespace Autumn
{

#define gRender Render::GetInstance()

class Texture;

class Render : public Singleton< Render >
{
	float						verts[ 8 ];
	float						tverts[ 8 ];

	std::map< std::string, Texture * >
								textures;
	std::map< std::string, Font * >	fonts;

	const Font *				font;

								Render( void );
								~Render( void );
public:
	const bool					Init( void );
	void						Shutdown( void );
	void						Frame( void );

	Texture * const				GetTexture( const char * name );
	Font * const				GetFont( const char * name );

	void						SetTexture( const Texture * texture );
	void						SetFont( const Font * font );

	void						SetOrthogonalProjection( float width, float height );
	void						SetPerspectiveProjection( float fov );
	void						PushMatrix( void );
	void						PopMatrix( void );
	void						Identity( void );
	void						Rotate( float angle );
	void						Rotate( float angle, float x, float y, float z );
	void						Scale( float scale );
	void						Scale( float x, float y, float z );
	void						Translate( float x, float y, float z );

	void						SetColor( float red, float green, float blue, float alpha = 1.f );

	void						DrawRectangle( float x, float y, float width, float height );
	void						DrawPolygon( float * verts, float * tverts, int numPoints );

	void						Print( Font::HorizontalAlign ha, Font::VerticalAlign va, float x, float y, float scale, const char * text/*, ...*/ );

	friend class				Singleton< Render >;
};

}	// namespace Autumn

#endif	// !!! __AUTUMN_RENDER_H__ !!!